/******************************************************************************
 * Copyright 2023 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#pragma once

#include "modules/canbus_vehicle/x3epro/proto/x3epro.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"

namespace apollo {
namespace canbus {
namespace x3epro {

class Vcudrivereport52 : public ::apollo::drivers::canbus::ProtocolData<
                    ::apollo::canbus::X3epro> {
 public:
  static const int32_t ID;
  Vcudrivereport52();
  void Parse(const std::uint8_t* bytes, int32_t length,
                     X3epro* chassis) const override;

 private:

    // config detail: {'bit': 0, 'enum': {0: 'DRIVE_ENABLE_RESP_INVALID', 1: 'DRIVE_ENABLE_RESP_VALID'}, 'is_signed_var': False, 'len': 1, 'name': 'Drive_Enable_Resp', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
    Vcu_drive_report_52::Drive_enable_respType drive_enable_resp(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 6, 'enum': {0: 'CONTROL_MODE_RESP_STANDBY', 1: 'CONTROL_MODE_RESP_AUTO_DRIVE', 2: 'CONTROL_MODE_RESP_NET_DRIVE', 3: 'CONTROL_MODE_RESP_REMOTE_CONTROL', 4: 'CONTROL_MODE_RESP_EMERGENCY_BRAKE'}, 'is_signed_var': False, 'len': 3, 'name': 'Control_Mode_Resp', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
    Vcu_drive_report_52::Control_mode_respType control_mode_resp(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 9, 'enum': {0: 'VCU_REAL_SHIFT_N', 1: 'VCU_REAL_SHIFT_D', 2: 'VCU_REAL_SHIFT_R', 3: 'VCU_REAL_SHIFT_RESERVED'}, 'is_signed_var': False, 'len': 2, 'name': 'VCU_Real_Shift', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
    Vcu_drive_report_52::Vcu_real_shiftType vcu_real_shift(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 10, 'enum': {0: 'VCU_REAL_SHIFT_INVALID', 1: 'VCU_REAL_SHIFT_VALID'}, 'is_signed_var': False, 'len': 1, 'name': 'VCU_Real_Shift_Valid', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
    Vcu_drive_report_52::Vcu_real_shift_validType vcu_real_shift_valid(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 11, 'enum': {0: 'VCU_REAL_TORQUE_INVALID', 1: 'VCU_REAL_TORQUE_VALID'}, 'is_signed_var': False, 'len': 1, 'name': 'VCU_Real_Torque_Valid', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
    Vcu_drive_report_52::Vcu_real_torque_validType vcu_real_torque_valid(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 23, 'is_signed_var': False, 'len': 16, 'name': 'VCU_Real_Torque', 'offset': -665.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'Nm', 'precision': 0.02, 'type': 'double'}
    double vcu_real_torque(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 32, 'enum': {0: 'VCU_LIMITEDTORQUEMODE_INVALID', 1: 'VCU_LIMITEDTORQUEMODE_VALID'}, 'is_signed_var': False, 'len': 1, 'name': 'VCU_LimitedTorqueMode', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
    Vcu_drive_report_52::Vcu_limitedtorquemodeType vcu_limitedtorquemode(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 51, 'is_signed_var': False, 'len': 4, 'name': 'VCU_DriveRept_AliveCounter', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
    int vcu_driverept_alivecounter(const std::uint8_t* bytes, const int32_t length) const;

    // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name': 'VCU_DriveRept_CheckSum', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
    int vcu_driverept_checksum(const std::uint8_t* bytes, const int32_t length) const;
};

}  // namespace x3epro
}  // namespace canbus
}  // namespace apollo


